<?php

namespace app\common\model;

use app\common\model\search\ShoppingClassifySearch;

class ShoppingClassify extends BaseModel
{
    use ShoppingClassifySearch;

    protected $name = 'shopping_classify';

    /**
     * 获取数据列表
     * @param string $field 字段
     * @param string $sort 排序字段
     * @return array
     */
    public function getList(string $field='*', string $sort='sort'): array
    {
        $ret = $this->mongoSearch()
            ->field($field)
            ->order($sort, 'desc')
            ->select();

        if ($this->enterSearch === false) {
            return $ret->toTree();
        }
        return $ret->toArray();
    }
}